home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / OOPTUT34.ZIP / STAFFOOP.PAS < prev    next >
Pascal/Delphi Source File  |  1992-11-09  |  2KB  |  69 lines

  1. program staff_oop;
  2.  
  3. uses Crt;
  4.  
  5. type
  6.  
  7. staff = object
  8.       Name : string;
  9.       constructor Init(FirstName : string );
  10.       procedure script; { virtual; }   {remove braces around virtual to correct}
  11.       procedure action;
  12.       end;
  13.  
  14. junior = object( staff )
  15.            procedure script; { virtual; } {remove braces around virtual to correct}
  16.            end;
  17.  
  18. constructor staff.Init( FirstName : string );
  19. begin
  20.      Name := FirstName;
  21. end;
  22.  
  23. procedure staff.script;
  24. begin
  25.      writeln( Name,
  26.          ': Please send the duplicated letters to all our customers.');
  27.      writeln( '        If you have a problem, please phone me.');
  28. end;
  29.  
  30. procedure staff.action;
  31. begin
  32.      script;
  33. end;
  34.  
  35. procedure junior.script;
  36. var
  37.     LetterName : string;
  38. begin
  39.      writeln( 'PHONE: Brrring!');
  40.      writeln( '<pick up phone>' );
  41.      writeln( 'YOU: Hello?' );
  42.      writeln( Name, ': I do not know the letter to send for an overdraft?' );
  43.      write( 'YOU (enter something): ');
  44.      readln( LetterName );
  45.      writeln( Name, ': Thank you. Bye.');
  46.      writeln( '<hang up phone>' );
  47.      writeln( '<pause.......>' );
  48.      writeln( '<later phone call to confirm>');
  49.      writeln( Name, ': As you requested, I sent: ',LetterName );
  50. end;
  51.  
  52. var
  53.    Little : junior;
  54.    Large  : staff;
  55.  
  56. begin
  57.      clrscr;
  58.      Little.Init( 'LITTLE' );
  59.      Large.Init( 'LARGE' );
  60.  
  61.      Large.action;
  62.      Little.action;
  63.      gotoXY(10,24);
  64.      writeln('Press any key to conclude: ');
  65.      repeat until keypressed;
  66.  
  67. end.
  68.  
  69. { end of Listing }